// Created from GroupGenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class CLOCK_AND_STATS_WITH_NOTES_NMD_N02 : AbstractGroup
    {
        /// -----------------------------
        /// -----------------------------
		[DataMember]
	    [PropertyClassification("4 CLOCK",4)]
  	    [HL7Field(HL7Version.v231, 4, HL7Repeat.False, HL7Required.False,"CLOCK_NMD_N02")]
	    public CLOCK_NMD_N02 CLOCK {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
	    [PropertyClassification("8 APP_STATS",8)]
  	    [HL7Field(HL7Version.v231, 8, HL7Repeat.False, HL7Required.False,"APP_STATS_NMD_N02")]
	    public APP_STATS_NMD_N02 APP_STATS {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
	    [PropertyClassification("12 APP_STATUS",12)]
  	    [HL7Field(HL7Version.v231, 12, HL7Repeat.False, HL7Required.False,"APP_STATUS_NMD_N02")]
	    public APP_STATUS_NMD_N02 APP_STATUS {get;set;}



		#region Parser Helpers and Conrete Impls

        internal override void ConsumeTextSegmentsForGroup(Stack<string> availableData, HL7ParserOptions options) {

			CLOCK = ProcessGroup<CLOCK_NMD_N02>(availableData, options, "CLOCK");
			APP_STATS = ProcessGroup<APP_STATS_NMD_N02>(availableData, options, "APP_STATS");
			APP_STATUS = ProcessGroup<APP_STATUS_NMD_N02>(availableData, options, "APP_STATUS");
        }

		internal override bool CanConsume(string availableData, HL7ParserOptions options)
        {
			CLOCK_NMD_N02 testCLOCK_NMD_N02 = new CLOCK_NMD_N02();
			bool grpCCCLOCK_NMD_N02 = (testCLOCK_NMD_N02.CanConsume(availableData, options));
			if (IsRequired("CLOCK", options.Version) || grpCCCLOCK_NMD_N02) {
				return grpCCCLOCK_NMD_N02;
			}
			APP_STATS_NMD_N02 testAPP_STATS_NMD_N02 = new APP_STATS_NMD_N02();
			bool grpCCAPP_STATS_NMD_N02 = (testAPP_STATS_NMD_N02.CanConsume(availableData, options));
			if (IsRequired("APP_STATS", options.Version) || grpCCAPP_STATS_NMD_N02) {
				return grpCCAPP_STATS_NMD_N02;
			}
			APP_STATUS_NMD_N02 testAPP_STATUS_NMD_N02 = new APP_STATUS_NMD_N02();
			bool grpCCAPP_STATUS_NMD_N02 = (testAPP_STATUS_NMD_N02.CanConsume(availableData, options));
			if (IsRequired("APP_STATUS", options.Version) || grpCCAPP_STATUS_NMD_N02) {
				return grpCCAPP_STATUS_NMD_N02;
			}
			return false;
        }

        private static Dictionary<string, bool> SEGMENT_VERSION_REQUIRED_MAP = new Dictionary<string, bool>();

		protected override Dictionary<string, bool> MAP_OF_SEGMENT_TO_REQUIRED
        {
            get
			{
				return SEGMENT_VERSION_REQUIRED_MAP;
			}
        }

		public override string HL7ENTITY_TYPE_NAME
        {
            get {
				return "CLOCK_AND_STATS_WITH_NOTES";
			}
        }

        static CLOCK_AND_STATS_WITH_NOTES_NMD_N02() {

             SetupStaticPropertyMap(SEGMENT_VERSION_REQUIRED_MAP, typeof(CLOCK_AND_STATS_WITH_NOTES_NMD_N02));

        }

		#endregion

		public override string GetER7(HL7ParserOptions options)
		{
			List<string> segmentData = new List<string>();
		 if (CLOCK != null) {
			string segmentValue = CLOCK.GetER7(options);
			if (string.IsNullOrEmpty(segmentValue) == false) {
				segmentData.Add(segmentValue);
			}
		 }
		 if (APP_STATS != null) {
			string segmentValue = APP_STATS.GetER7(options);
			if (string.IsNullOrEmpty(segmentValue) == false) {
				segmentData.Add(segmentValue);
			}
		 }
		 if (APP_STATUS != null) {
			string segmentValue = APP_STATUS.GetER7(options);
			if (string.IsNullOrEmpty(segmentValue) == false) {
				segmentData.Add(segmentValue);
			}
		 }
           return string.Join(HL7ParserConstants.SEGMENT_SEPARATOR, segmentData.ToArray());
        
        }
    }
}

